﻿using Abp.AutoMapper;
using Abp.Collections.Extensions;
using Paas.Core.Const;
using Paas.Core.Sys.Entities;
using Basefr.App.Dtos;
using Basefr.Runtime.Helpers;
using System.Collections.Generic;
using System.Linq;

namespace Paas.App.Interface.Sys.Admin.Dtos
{
    [AutoMap(typeof(Role))]
    public class RoleDto : DtoBase
    {
        public string Name { get; set; }
        public bool IsActive { get; set; }

        public bool IsPreDefined { get; set; }

        public List<RolePermissionDto> Permissions { get; set; }

        [AutoMap(typeof(RolePermission))]
        public class RolePermissionDto
        {
            public int RoleId { get; set; }
            public string Permission { get; set; }

            public bool IsDeleted { get; set; }
        }

        public string PermissionNames { get; set; }
        //public string PermissionNames => Permissions?.Select(p => PermissionHelper.GetDescriptionByValue<Permissions>(p.Permission)).JoinAsString("，") ?? "";

    }
}

